﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Document_Management.tianche;

namespace Document_Management.tianche
{
    public partial class frm天車編號選項 : Form
    {
        TextBox tx;
        public frm天車編號選項(TextBox tx)
        {
            InitializeComponent();
            this.tx = tx;
        }
        
      

        private void 天車_Load(object sender, EventArgs e)
        {
            //_txt天車編號.Text="";
            //_txt額定荷重.Text="";
            //_txt功能.Text="";
            //_txt廠牌.Text="";
            //_txt生產序號.Text="";
            PublicClass.SearchbyTianchebianhao(dtgv天車編號選項, _txt天車編號.Text, _txt額定荷重.Text, _txt功能.Text, _txt廠牌.Text, _txt生產序號.Text, dtp生產日期from.Value, dtp生產日期to.Value);

        }

        private void btn_search_tianchebianhao_Click(object sender, EventArgs e)
        {
            PublicClass.SearchbyTianchebianhao(dtgv天車編號選項, _txt天車編號.Text, _txt額定荷重.Text, _txt功能.Text, _txt廠牌.Text, _txt生產序號.Text, dtp生產日期from.Value, dtp生產日期to.Value);
        }

        private void dtgv天車編號選項_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            PublicClass.setRowNumber(dtgv天車編號選項);
        }

        private void dtgv天車編號選項_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //try
            //{
            //    int r = e.RowIndex;
            //    string id = dtgv天車編號選項.Rows[r].Cells[0].Value.ToString();
            //    tx.Text = id;
            //    this.Close();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
        }

        private void btn_OK_天車編號_Click(object sender, EventArgs e)
        {
            try
            {
                int r = dtgv天車編號選項.CurrentCell.RowIndex;
                string id = dtgv天車編號選項.Rows[r].Cells[0].Value.ToString();
                tx.Text = id;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
     
  

      
    }
}
